package com.gson.bean;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

/**
 * @Company 陕西识代运筹信息科技股份有限公司
 * @Discription微信第三方平台获取授权公众号消息实体
 * {"authorization_info":{
 *          "authorizer_appid":"wx4284c021b171c0b8",
 *          "authorizer_access_token":"HXGUUh7e0N_TsF3AdKggpxwNqCBMGNITZAd6VyZySP4naEeSlbasGX4rgZw1QaX2bYmNvAPjgIeDLjKM
 *          qYVZ-humi7oEpA46Zs8TlhjasM5MNdfp9OqkSJyMfGwZBMISTFLbAHDHTZ",
 *          "expires_in":7200,
 *          "authorizer_refresh_token":"refreshtoken@@@sbRCEjbq-y6XnUOAWV1meCn7jfZx_iEy92-KABdsmL4",
 *          "func_info":[{"funcscope_category":{"id":1}},{"funcscope_category":{"id":15}},
 *          {"funcscope_category":{"id":4}},{"funcscope_category":{"id":7}},{"funcscope_category":{"id":2}},
 *          {"funcscope_category":{"id":3}},{"funcscope_category":{"id":11}},{"funcscope_category":{"id":6}},
 *          {"funcscope_category":{"id":5}},{"funcscope_category":{"id":8}},{"funcscope_category":{"id":13}},
 *          {"funcscope_category":{"id":9}},{"funcscope_category":{"id":10}},{"funcscope_category":{"id":12}}]}}
 * @Author houfengli
 * @CreateDate 2017/2/20 17:10
 * @Version 1.0
 */
public class AuthorizationInfo {
    private String authorizer_appid;
    private String authorizer_access_token;
    private long expires_in;
    private String authorizer_refresh_token;
    private Func_info[] func_info;

    public String getAuthorizer_appid() {
        return authorizer_appid;
    }

    public void setAuthorizer_appid(String authorizer_appid) {
        this.authorizer_appid = authorizer_appid;
    }

    public String getAuthorizer_access_token() {
        return authorizer_access_token;
    }

    public void setAuthorizer_access_token(String authorizer_access_token) {
        this.authorizer_access_token = authorizer_access_token;
    }

    public long getExpires_in() {
        return expires_in;
    }

    public void setExpires_in(long expires_in) {
        this.expires_in = expires_in;
    }

    public String getAuthorizer_refresh_token() {
        return authorizer_refresh_token;
    }

    public void setAuthorizer_refresh_token(String authorizer_refresh_token) {
        this.authorizer_refresh_token = authorizer_refresh_token;
    }

    public Func_info[] getFunc_info() {
        return func_info;
    }

    public void setFunc_info(Func_info[] func_info) {
        this.func_info = func_info;
    }

    public static class Func_info{
        private FuncscopeCategory funcscope_category;

        public FuncscopeCategory getFuncscope_category() {
            return funcscope_category;
        }

        public void setFuncscope_category(FuncscopeCategory funcscope_category) {
            this.funcscope_category = funcscope_category;
        }

        @Override
        public String toString() {
            return "Func_info{" +
                    "funcscope_category=" + funcscope_category +
                    '}';
        }
    }
    public static class FuncscopeCategory{
        private int id;

        public int getId() {
            return id;
        }

        public void setId(int id) {
            this.id = id;
        }

        @Override
        public String toString() {
            return "FuncscopeCategory{" +
                    "id=" + id +
                    '}';
        }
    }
    @Override
    public String toString() {
        return "AuthorizationInfo{" +
                "authorizer_appid='" + authorizer_appid + '\'' +
                ", authorizer_access_token='" + authorizer_access_token + '\'' +
                ", expires_in=" + expires_in +
                ", authorizer_refresh_token='" + authorizer_refresh_token + '\'' +
                ", func_info=" + func_info +
                '}';
    }

    public static void main(String [] args){
        String str="{\"authorization_info\":{\"authorizer_appid\":\"wx4284c021b171c0b8\",\"authorizer_access_token\":\"HXGUUh7e0N_TsF3AdKggpxwNqCBMGNITZAd6VyZySP4naEeSlbasGX4rgZw1QaX2bYmNvAPjgIeDLjKMqYVZ-humi7oEpA46Zs8TlhjasM5MNdfp9OqkSJyMfGwZBMISTFLbAHDHTZ\",\"expires_in\":7200,\"authorizer_refresh_token\":\"refreshtoken@@@sbRCEjbq-y6XnUOAWV1meCn7jfZx_iEy92-KABdsmL4\",\"func_info\":[{\"funcscope_category\":{\"id\":1}},{\"funcscope_category\":{\"id\":15}},{\"funcscope_category\":{\"id\":4}},{\"funcscope_category\":{\"id\":7}},{\"funcscope_category\":{\"id\":2}},{\"funcscope_category\":{\"id\":3}},{\"funcscope_category\":{\"id\":11}},{\"funcscope_category\":{\"id\":6}},{\"funcscope_category\":{\"id\":5}},{\"funcscope_category\":{\"id\":8}},{\"funcscope_category\":{\"id\":13}},{\"funcscope_category\":{\"id\":9}},{\"funcscope_category\":{\"id\":10}},{\"funcscope_category\":{\"id\":12}}]}}";
        JSONObject object = JSON.parseObject(str);
        AuthorizationInfo info= object.getObject("authorization_info",AuthorizationInfo.class);
        System.out.println(info);
    }
}
